<template>
  <div class="app-container calendar-list-container">
    <basic-container>
      <avue-form :option="option" v-model="form" @submit="submitForm"></avue-form>
    </basic-container>
  </div>
</template>

<script>
import { addText, getText } from "@/api/admin/set";
import { mapState } from "vuex";
import store from "@/store";
import request from "@/router/axios";

export default {
  data() {
    return {
      switchStatus: "",
      avatarUrl: "",
      show: false,
      headers: {
        Authorization: "Bearer " + store.getters.access_token
      },
      form: {},
      option: {
        labelWidth: 120,
        emptyBtn: false,
        column: [
          {
                  label: "客服电话",
                  prop: "content",
              },
          {
            label: '客服微信',
            prop: 'contentTxt',
            type: 'upload',
            listType: 'picture-img',
            span: 24,
            propsHttp: {
                name: 'hash',
                url: "key"
              },
            oss: 'qiniu',
            tip: '只能上传jpg/png用户头像，且不超过500kb',
          },
        ]
      }
    };
  },
  created() {
    this.getContnet()
  },
  computed: {
    ...mapState({
      userInfo: state => state.user.userInfo
    })
  },
  methods: {
    getContnet(){
      getText(10).then(res=>{
        this.form = res.data.data
      })
    },
    switchTab(tab, event) {
      this.switchStatus = tab.name;
    },
    submitForm(form,done) {
      addText(Object.assign({id: 10}, this.form)).then(response => {
        this.$message.success('修改成功');
        done()
      });
    },
    resetForm(formName) {
      try {
        this.$refs[formName].resetFields();
      } catch (e) {}
    }
  }
};
</script>
<style>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}

.avatar-uploader-icon {
  font-size: 28px !important;
  color: #8c939d !important;
  width: 178px !important;
  height: 178px !important;
  line-height: 178px !important;
  text-align: center !important;
}

.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
